<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>tebar</title>
    <link rel="stylesheet" href="./taber.css" />
  </head>
  <body>
    <div id="app" class="navigation">
      <ul>
        <li
          class="list"
          v-for="(list,index) in tabList"
          :key="index"
          :class="{active:index===active?true:false}"
          @click="switchTab(index)"
        >
          <a href="#">
            <span class="icon">
              <ion-icon :name="list.icon"></ion-icon>
            </span>
            <span class="text">{{list.text}}</span>
          </a>
        </li>
        <div
          class="indicator"
          ref="indicator"
          :style="{left:active*70+20+'px'}"
        ></div>
      </ul>
    </div>
    <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>

    <script>
      const vm = new Vue({
        el: "#app",
        data() {
          return {
            tabList: [
              {
                icon: "home-outline",
                text: "Home",
              },
              {
                icon: "newspaper-outline",
                text: "Message",
              },
              {
                icon: "chatbubble-ellipses-outline",
                text: "Chatting",
              },
              {
                icon: "person-outline",
                text: "Setting",
              },
            ],
            active: 0,
          }
        },
        methods: {
          switchTab(index) {
            this.active = index
          },
        },
      })
    </script>
    <script
      type="module"
      src="https://unpkg.com/ionicons@5.5.2/dist/ionicons/ionicons.esm.js"
    ></script>
    <script
      nomodule
      src="https://unpkg.com/ionicons@5.5.2/dist/ionicons/ionicons.js"
    ></script>
  </body>
</html>
